<template>
  <view class="container-page login-container-page">
    <view class="login-head-desc">
      <image class="logo"
             src="@/static/img/logo.png"
             mode=""></image>
      <!-- <navigator class="back-home-box"
                 url="/pages/home/index">
        回到首页
      </navigator> -->
      <view class="container-main">
        <view class="login-head-title">
          您好，<br />
          巴山黄牛供应链平台
        </view>
        <view class="login-main">
          <!-- 登录方式tabs -->
          <view class="login-tabs">
            <view v-for="(tab) in tabBars"
                  :key="tab.code"
                  class="swiper-tab-list"
                  :class="{'active' : loginMode == tab.code}"
                  @tap="tapTabBars(tab)">
              {{tab.name}}
              <view class="swiper-tab-line"></view>
            </view>
          </view>
          <AccountLogin :url="pageUrl"
                        :isRead="true"
                        :login-mode="loginMode" />
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import {
  mapState
} from 'vuex'
import AccountLogin from './components/AccountLogin.vue'
export default {
  components: {
    AccountLogin
  },
  data () {
    return {
      tabBars: [{
        name: '账号登录',
        code: '01'
      }
      ],
      loginMode: '01',
      pageUrl: ''
    }
  },
  onLoad: function (option) {
    this.pageUrl = '/pages/home/index'
  },
  computed: {
    localPicture () {
      return this.$localPicture
    }
  },
  methods: {
    tapTabBars (item) {
      this.loginMode = item.code
    },
    viewFile (type) {
      uni.navigateTo({
        url: '/pages/login/components/agreement?type=' + type
      })
    }
  }
}
</script>

<style lang="scss">
.login-container-page {
  width: 100vw;
  height: 100vh;

  .back-home-box {
    position: fixed;
    top: 32rpx;
    right: 32rpx;
    color: #333333;
    font-size: 16px;
    font-weight: 400;
    display: flex;
    align-items: center;
    z-index: 3333;

    image {
      height: 48rpx;
      width: 48rpx;
      margin-right: 8rpx;
    }
  }

  .login-head-desc {
    background: #f5f5f5;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;

    .logo {
      position: absolute;
      right: 56rpx;
      top: 80rpx;
      width: 156rpx;
      height: 156rpx;
      vertical-align: middle;
      margin-left: auto;
    }
  }

  .container-main {
    width: 100%;
    padding: 0 32rpx;
    box-sizing: border-box;
    z-index: 5;
  }

  .login-head-title {
    color: $uni-color-success;
    font-size: 24rpx;
    font-weight: 500;
    padding: 98rpx 0 46rpx 0;

    .second-level {
      color: #333;
      font-size: 28rpx;
      margin-top: 16rpx;
    }
  }

  // tabs
  /deep/ .u-tabs__wrapper__nav {
    margin-left: -11px;

    &__item {
      position: relative;

      &:first-child::before {
        content: "";
        position: absolute;
        right: 0;
        width: 2rpx;
        height: 30rpx;
        background-color: #e7e7e7;
      }
    }

    &__item__text {
      font-size: 32rpx;
    }
  }

  .login-tabs {
    width: 330rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .swiper-tab-list {
    display: inline-block;
    color: #666;
    line-height: 80rpx;
    font-size: 32rpx;
    position: relative;

    &:first-child::before {
      content: "";
      position: absolute;
      top: 26rpx;
      right: -22rpx;
      width: 2rpx;
      height: 30rpx;
      background-color: #e7e7e7;
    }

    &.active {
      color: $uni-color-success;
      font-weight: bold;
    }
  }

  .active .swiper-tab-line {
    border-bottom: 4rpx solid $uni-color-success;
  }

  .agreement {
    margin-top: 128rpx;
    text-align: left;

    .text {
      font-size: 24rpx;
      color: $uni-color-success !important;
      line-height: 1;
    }
  }

  .interval {
    margin-top: 188rpx;
  }

  .input-wrap {
    display: flex;
    align-items: center;
    border-bottom: 2rpx solid $uni-color-success;
    margin-top: 50rpx;
    padding: 10rpx 0 10rpx 16rpx;

    .area-code {
      display: flex;
      align-items: center;

      image {
        width: 40rpx;
        height: 40rpx;
      }

      .line {
        color: #b9b8b6;
        margin: 0 20rpx 0 0;
      }
    }

    image {
      width: 64rpx;
      height: 64rpx;
      margin-right: 16rpx;
      vertical-align: middle;
    }

    input {
      font-size: 28rpx;
      color: #333;
      flex: 1;
    }

    .paw-close {
      margin-left: auto;
      margin-right: 0;
    }

    .code-btn {
      font-size: 28rpx;
      color: #fd4723;
      margin-left: auto;
    }
  }

  .forget-password {
    display: flex;
    justify-content: flex-end;
    margin-top: 26rpx;
    font-size: 28rpx;
    color: #333;
  }

  .longin-btn {
    width: 100%;
    height: 80rpx;
    line-height: 80rpx;
    border-radius: 1000rpx;
    text-align: center;
    color: #fff;
    margin-top: 126rpx;
    background: $uni-color-success;

    &.longin-disabled {
      background: rgba(33, 158, 76, 0.3);
    }
  }

  .account-tips {
    font-size: 28rpx;
    color: #666;
    margin-top: 16rpx;

    .no-account {
      display: flex;
      justify-content: center;

      view {
        color: $uni-color-success;
      }
    }
  }
}

.login-form {
  position: relative;
}

.code-input {
  margin: auto;
  width: 650rpx;
  height: 100rpx;
  display: flex;
}

.code-input > view {
  margin-top: 5rpx;
  margin-left: 15rpx;
  width: 86rpx;
  height: 86rpx;
  line-height: 86rpx;
  font-size: 60rpx;
  font-weight: bold;
  color: #313131;
  text-align: center;
}

.code-input > view:nth-child(1) {
  margin-left: 0rpx;
}

.cinput {
  position: fixed;
  left: -100rpx;
  width: 50rpx;
  height: 50rpx;
}
</style>
